package com.vueadmin.zxn.service;

import com.vueadmin.zxn.mapper.RoomMapper;
import com.vueadmin.zxn.model.Room;
import com.vueadmin.zxn.model.RoomExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoomService {
    @Autowired
    private RoomMapper roomMapper;

    @Autowired
    private RoomExample roomExample;

    public Room getById(String id){
        return roomMapper.selectByPrimaryKey(id);
    }

    public void addRoom(Room room){
        roomMapper.insert(room);
    }

    public List<Room> getall(){
        return roomMapper.selectByExample(roomExample);
    }

    public long count(){
        return roomMapper.countByExample(roomExample);
    }

}
